﻿using System;
namespace School
{
    class Student
    {
        private string name;
        private int facultyNumber;

        public Student(string name, int facultyNumber) 
        {
            VerifyNameIsNotNull(name);
            VerifyNameIsNotEmptyString(name);
            VerifyFacultyNumber(facultyNumber);
            this.facultyNumber = facultyNumber;
            this.name = name;
        }

        public int FacultyNumber
        {
            get
            {
                return facultyNumber;
            }
            set
            {
                VerifyFacultyNumber(value);
                facultyNumber = value;
            }
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                VerifyNameIsNotNull(value);
                VerifyNameIsNotEmptyString(value);
                name = value;
            }
        }

        private void VerifyFacultyNumber(int value)
        {
            if (value < 10000 || value > 99999)
            {
                throw new ArgumentOutOfRangeException("Invalid faculty Number");
            }
        }

        private void VerifyNameIsNotNull(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("Student name can`t be null");
            }
        }
        private void VerifyNameIsNotEmptyString(string value)
        {
            if (value == string.Empty)
            {
                throw new ArgumentOutOfRangeException("The student name can`t be empty string");
            }
        }
    }
}
